const builder = require('electron-builder')
const os = require('os')
const path = require('path')
const config = require(path.resolve(process.cwd(), './package.json')).build || {}
module.exports = () => {
  const Platform = builder.Platform
  const platform = os.platform() === 'win32' ? 'WINDOWS' : os.platform() === 'LINUX' ? 'Linux' : 'MAC'
  builder.build({
    targets: Platform[platform].createTarget(),
    config
  })
    .then(result => {
      console.log(result)
    })
    .catch((error) => {
      console.error(error)
    })
}
